#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2022/10/20 22:08
# @Author  : when
# @File    : base_proxy.py
# @Description : 代理基类
import abc


class BaseProxy(metaclass=abc.ABCMeta):
    @abc.abstractmethod
    def get_proxy(self):
        """
        获取代理，需要上层实现
        :return: ip:port
        """
        return self

    def get_http_proxy(self):
        res = self.get_proxy()
        return f"http://{res}"

    def get_https_proxy(self):
        res = self.get_proxy()
        return f"https://{res}"
